<template>
	<view class="page-fade-in" :style="{opacity: pageOpc}">
		<template v-if="pageOpc">
			<view class="container">
				<view class="modle-title">活动设置</view>
				<view class="modle-info-box">
					<view class="info-item flexWrapNo">
						<view>活动名称：</view>
						<input placeholder="请输入活动名称,最多15个字" 
							maxlength="15"
							placeholder-class="placeholderclass" 
							v-model="form.activeName" 
							@paste="onPaste"
						/>
					</view>
					
					<view class="info-item flexWrap">
						<view class="flexWrapNo" style="flex: 1;">
							<view>集球开始日期：</view>
							<picker mode="date" :data-index='0' :value="collectionBallStartTime" @change="bindDateChange" :start="currentDate">
								<view class="select-input" v-if="collectionBallStartTime">{{collectionBallStartTime}}</view>
								<view class="select-input" v-else>请选择开始日期</view>
							</picker>
						</view>
						<text class="icon-more"></text>
					</view>
					<view class="info-item flexWrap">
						<view class="flexWrapNo" style="flex: 1;">
							<view>集球结束日期：</view>
							<picker mode="date" :data-index='1' :value="collectionBallEndTime" @change="bindDateChange" :start="collectionBallStartTime">
								<view class="select-input" v-if="collectionBallEndTime">{{collectionBallEndTime}}</view>
								<view class="select-input" v-else>请选择结束日期</view>
							</picker>
						</view>
						<text class="icon-more"></text>
					</view>
					
					<view class="info-item flexWrap">
						<view class="flexWrapNo" style="flex: 1;">
							<view>开奖开始日期：</view>
							<picker mode="date" :data-index='2' :value="lotteryDate" @change="bindDateChange" :start="nextDay">
								<view class="select-input" v-if="lotteryDate">{{lotteryDate}}</view>
								<view class="select-input" v-else>请选择开奖开始日期</view>
							</picker>
						</view>
						<text class="icon-more"></text>
					</view>
					<view class="info-item flexWrap">
						<view class="flexWrapNo" style="flex: 1;">
							<view>开奖开始时间：</view>
							<picker mode="time" :value="lotteryTime" @change="bindTimeChange">
								<view class="select-input" v-if="lotteryTime">{{lotteryTime}}</view>
								<view class="select-input" v-else>请选择开奖开始时间</view>
							</picker>
						</view>
						<text class="icon-more"></text>
					</view>
					<view class="remaks-box">
						默认开奖开始日期起，24小时内可开奖
					</view>
					
					<view class="info-item flexWrap">
						<view class="flexWrapNo" style="flex: 1;">
							<view>已集齐人数：</view>
							<input placeholder="请输入整数,最多填写99" 
								placeholder-class="placeholderclass" 
								v-model="form.assembledPersonsNumber" type="number" 
								maxlength="2"
							/>
						</view>
					</view>
					<view class="remaks-box">
						活动页面预先展示已集齐的人数
					</view>
					
					<view class="info-item flexWrap">
						<view class="flexWrapNo" style="flex: 1;">
							<view>赠送抽球次数：</view>
							<input placeholder="请输入整数,最多填写2" 
								placeholder-class="placeholderclass" 
								v-model="form.giftsNumber" type="number" 
								maxlength="1"
							/>
						</view>
					</view>
					<view class="remaks-box">
						设置赠送给单个用户的抽球次数，填写0表示不赠送
					</view>	
				</view>
				
				<view class="modle-title">奖品设置</view>
				<view class="remaks-box">
					可设置3-5个奖品，同一类型添加多个算多个奖品
				</view>	
				<view class="modle-info-box" style="margin-bottom: 30rpx;" v-for="(item,index) in prizeData" :key="index">
					<view class="flexWrap">
						<view class="info-item flexWrapNo" style="flex: 1;">
							<view>类型：</view>
							<picker @change="bindTypeChange" :data-index="index" :value="typeIndex" :range="typeArray" range-key="label">
								<view class="uni-input" v-if="item.awardType">{{formatType(item.awardType)}}</view>
								<view class="uni-input" v-else>请选择</view>
							</picker>
						</view>
						<view @tap="delPrize(index)" v-if="prizeData.length>1">
							<uni-icons type="minus" size="30" color="#fff"></uni-icons>
						</view>
						<view @tap="addPrize" v-if="index==prizeData.length-1&&prizeData.length<5">
							<uni-icons type="plus" size="30" color="#26BCFD"></uni-icons>
						</view>
					</view>
					
					<view class="info-item flexWrap" v-if="item.awardType">
						<view class="flexWrapNo" style="flex: 1;">
							<view>发放概率：</view>
							<input placeholder="最多两位小数" 
								placeholder-class="placeholderclass" 
								v-model="item.probability" type="digit"
								:data-index="index"
								@input="checkTwoDecimal"
							/>
						</view>
						<text>%</text>
					</view>
					
					<view class="info-item flexWrapNo"  v-if="item.awardType">
						<view>发放数量：</view>
						<input placeholder="请输入整数" 
							placeholder-class="placeholderclass" 
							v-model="item.quantities" type="number" 
						/>
					</view>
					
					<view class="coupon-box" v-if="item.awardType==1">
						<view class="coupon-item flexWrapNo" v-if="item.couponId" @tap="choosePopup(index)">
							<view class="coupon-left flexWrapNo">
								<text class="money">{{item.couponInfo.price}}</text>
								<text class="money-tip">元</text>
							</view>
							<view class="coupon-line"></view>
							<view class="coupon-right flexWarpColumn">
								<text class="coupon-name">{{item.couponInfo.title}}</text>
								<text v-if="item.couponInfo.valid_timedata==1">有效期：永久</text>
								<text v-if="item.couponInfo.valid_timedata==2">有效期：{{item.couponInfo.start}} 至 {{item.couponInfo.end}}</text>
								<text v-if="item.couponInfo.valid_timedata==3">有效期：{{item.couponInfo.valid_configure}}天</text>
							</view>
						</view>
						<view class="select-box" v-else @tap="choosePopup(index)">
							<text class="select-text">+选择优惠券</text>
						</view>
					</view>
					
					<view class="info-item flexWrapNo" v-if="item.awardType==2">
						<view>单个发放金额：</view>
						<input placeholder="请输入整数" 
							placeholder-class="placeholderclass" 
							v-model="item.storeCardMoney" type="number" 
						/>
					</view>
					
					<block v-if="item.awardType==3">
						<view class="info-item">
							<view>图片：</view>
							<view class="attachment-box flexWrapNo">
								<view @tap="previewImage(val,item.imageList)" class="attachment-img"
									v-for="(val,k) in item.imageList" :key="k">
									<image :src="val" mode="aspectFill"></image>
									<image src="../../static/user/close.png" class="close-btn"
										@tap.stop="deleteImage(index,k)"></image>
								</view>
								<view class="add-btn" @tap="chooseImage(index)" v-if="item.imageList.length<1"></view>
							</view>
							<view class="attachment-tips">备注:最多上传1张图片，仅支持jpg、jpeg、png格式图片</view>
						</view>
						<view class="info-item flexWrapNo">
							<view>奖品名称：</view>
							<input placeholder="请输入奖品名称,最多5个字" 
								maxlength="5"
								placeholder-class="placeholderclass" 
								v-model="item.awardName" 
							/>
						</view>
						<view class="info-item flexWrapNo" style="align-items: flex-start;">
							<view style="flex-shrink: 0;">领取方式：</view>
							<view class="" style="flex: 1;">
								<textarea v-model="item.collectionMethods"
									placeholder-class="placeholderclass" 
									placeholder="请输入领取方式描述" 
									maxlength="42"
									:data-index="index"
									@input="onInput" 
								/>
								<view class="remaks-box">最多42个字</view>
							</view>	
						</view>		
					</block>
				</view>
				
				<view class="submit-btn" @tap="handleSubmit">提交保存</view>	
			</view>	
		</template>
	</view>
</template>

<script>
	import base from '@/common/base.js';
	export default{
		data(){
			const currentDate = this.getDate({
				format: true
			})
			return{
				pageOpc:0,
				id:'',
				currentDate:currentDate,
				collectionBallStartTime:'',
				collectionBallEndTime:'',
				lotteryDate:'',
				lotteryTime:'',
				form:{
					activeName:'',   // 活动名称
					collectionBallStartTime:'',  // 集球开始日期
					collectionBallEndTime:'',  //集球结束日期
					lotteryDate:'',  // 开奖开始日期
					lotteryTime:'', // 开奖开始时间
					assembledPersonsNumber:'' ,// 已集齐人数
					giftsNumber:'' ,// 赠送抽卡次数
					awardList:[], // 奖品集合
				},
				typeArray:[
					{label:'优惠券',value:1},
					{label:'门店卡余额',value:2},
					{label:'其他',value:3},
				],
				typeIndex:null,
				couponId:'',
				couponInfo:{},
				
				imageLength:1,
				
				prizeData:[
					{
						awardType:'',
						probability:'',
						couponId:'',
						couponInfo:{},
						storeCardMoney:'',
						quantities:'',
						awardName:'',
						awardImage:'',
						imageList:[],
						uploadList:[],
						collectionMethods:'',
					}
				],
				prizeIndex:null,
				delData:[],  // 编辑时删除奖品的数据
			}
		},
		
		onReady() {
			setTimeout(() => {
				this.pageOpc = 1
			}, 100)
		},
		onLoad(options) {
			this.id=options.id
			if(this.id){
				this.getDetail()
			}
		},
		
		computed: {
		    nextDay() {
		      const date = new Date(this.collectionBallEndTime);
		      date.setDate(date.getDate() + 1); // 在给定日期基础上加一天
			  let year = date.getFullYear();
			  let month = date.getMonth() + 1;
			  let day = date.getDate();
			  month = month > 9 ? month : '0' + month;
			  day = day > 9 ? day : '0' + day;
			  return `${year}-${month}-${day}`; // 格式化输出为YYYY-MM-DD
		    }
		},
		methods:{
			// 获取日期
			getDate(type) {
				const date = new Date();
				date.setDate(date.getDate());
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			
			onPaste(event) {
				// 处理粘贴时的内容限制
			    const clipboardData = event.clipboardData || window.clipboardData;
			    const pastedText = clipboardData.getData('text');
			
			    // 允许最多粘贴的字符
			    const maxLength = 15;
			    const remainingText = pastedText.slice(0, maxLength+1);
			
			    // 阻止默认粘贴行为并手动将处理后的文本设置到输入框
			    event.preventDefault();
			    // 这里需要使用$nextTick确保输入框的值被更新
			    this.$nextTick(() => {
			      event.target.value = remainingText;
			    });
			},
			
			// 选择日期
			bindDateChange(e){
				let index = e.currentTarget.dataset.index
				if (index == 0) {
					this.collectionBallStartTime = e.target.value
					this.collectionBallEndTime=''
					this.lotteryDate=''
					this.form.collectionBallStartTime=this.collectionBallStartTime+" 00:00:00"
				} else if(index==1){
					this.collectionBallEndTime = e.target.value
					this.lotteryDate=''
					this.form.collectionBallEndTime=this.collectionBallEndTime+" 23:59:59"
				}else{
					this.lotteryDate = e.target.value
					this.form.lotteryDate=this.lotteryDate
				}
			},
			
			// 选择时间
			bindTimeChange(e) {
				this.lotteryTime=e.target.value
				this.form.lotteryTime=this.lotteryTime+":00"
			},
			
			// 奖品类型
			bindTypeChange(e){
				let index = e.currentTarget.dataset.index
				this.typeIndex = e.detail.value
				this.prizeData[index].awardType=this.typeArray[this.typeIndex].value
				// 类型切换时 下面的字段数据先清空
				if(this.prizeData[index].awardType==1){
					this.prizeData[index].storeCardMoney=null
					this.prizeData[index].quantities=null
					this.prizeData[index].awardName=null
					this.prizeData[index].awardImage=null
					this.prizeData[index].imageList=[]
					this.prizeData[index].uploadList=[]
					this.prizeData[index].collectionMethods=null
					
				}else if(this.prizeData[index].awardType==2){
					this.prizeData[index].couponId=null
					this.prizeData[index].quantities=null
					this.prizeData[index].awardName=null
					this.prizeData[index].awardImage=null
					this.prizeData[index].imageList=[]
					this.prizeData[index].uploadList=[]
					this.prizeData[index].collectionMethods=null
				}else {
					this.prizeData[index].quantities=null
					this.prizeData[index].couponId=null
					this.prizeData[index].storeCardMoney=null
				}
			},
			
			// 回显奖励类型
			formatType(value){
				let foundData = this.typeArray.find(item => item.value ==value)
				return foundData.label
			},
			
			
			// 选择优惠券
			choosePopup(i){
				this.prizeIndex=i
				uni.navigateTo({
					url:'/pages/manage/couponList?isSelect=1'
				})
			},
			
			// 小数点后两位
			checkTwoDecimal(e){
				let index = e.currentTarget.dataset.index
				let value = e.target.value;
				// 使用正则表达式限制最多两位小数
				value = value.replace(/^(\-)*(\d+)\.(\d{2}).*$/, '$1$2.$3');
				this.$nextTick(() => {
					this.prizeData[index].probability=value
				})
			},
			
			// 获取优惠券信息
			getCouponInfo(){
				this.$request.post(this.$api.couponInfo, {
					store_id:uni.getStorageSync('store_id'),
					coupon_id:this.couponId
				}, {
					token:true
				}).then(res => {
					let {
						data = {}
					} = res;
					if (res.code==1) {
						if(data.valid_timedata==2){
							let customTimeArr=data.valid_configure.split(' - ')
							let start=customTimeArr[0]
							let end=customTimeArr[1]
							data.start=this.$tools.formatDay(start)
							data.end=this.$tools.formatDay(end)
						}
						this.couponInfo=data
						this.prizeData[this.prizeIndex].couponId=this.couponId
						this.prizeData[this.prizeIndex].couponInfo=this.couponInfo
					}
				})
			},
			
			//删除图片
			deleteImage(index,k) {
				this.prizeData[index].imageList.splice(k,1)
				this.prizeData[index].uploadList.splice(k,1)
			},
			
			chooseImage: async function(index) {
				var that = this
				that.prizeIndex=index
				uni.chooseImage({
					count: this.imageLength - this.prizeData[this.prizeIndex].imageList.length,
					extension: ['.jpg', '.png', '.jpeg'],
					success: (res) => {
						// console.log(res)
						for (let i in res.tempFilePaths) {
							var imgFiles = res.tempFilePaths[i]
							let suffix = res.tempFilePaths[i].split('.')[1]
							if (suffix != 'jpg' && suffix != 'png' && suffix != 'jpeg') {
								this.$tools.showToast('图片仅支持jpg、jpeg、png');
								return;
							}
							that.cutImageCallback(imgFiles);
						}
						that.prizeData[that.prizeIndex].imageList=that.prizeData[that.prizeIndex].imageList.concat(res.tempFilePaths)
						console.log(that.prizeData)
						// that.imageList = that.imageList.concat(res.tempFilePaths)
					}
				})
			},
			
			cutImageCallback(content) {
				let that = this;
				let httpsHead = 'https://moyu24h-new.oss-cn-chengdu.aliyuncs.com/'
				that.$tools.loadIng('上传中,请稍后..')
				base.aliyun_upload(content, function(r, err) {
					if (r) {
						let uploadimg = httpsHead + r
						// console.log(r)
						// that.uploadList = that.uploadList.concat(uploadimg);
						that.prizeData[that.prizeIndex].uploadList=that.prizeData[that.prizeIndex].uploadList.concat(uploadimg)
						uni.hideLoading();
					}
				})
			},
			
			// 领取方式描述输入
			onInput(event) {
				let index = event.currentTarget.dataset.index
				let value = event.target.value.trim()
				if (value.length > 42) {
					value = value.slice(0, 42)
					this.priceData[index] = value
				}
			},
			
			// 删除奖品
			delPrize(i){
				if(this.prizeData.length>1){
					if(this.form.id){ // 编辑
						this.delData.push(this.prizeData[i])
					}
					this.prizeData.splice(i,1)
				}
			},
			
			// 新增奖品
			addPrize(){
				let obj={
					awardType:'',
					probability:'',
					couponId:'',
					couponInfo:{},
					storeCardMoney:'',
					quantities:'',
					awardName:'',
					awardImage:'',
					imageList:[],
					uploadList:[],
					collectionMethods:'',
				}
				this.prizeData.push(obj)
			},
			
			// 获取详情
			getDetail(){
				this.$request.post(this.$api.collectBallActiveDetail,{
					id:this.id
				}, {
					isJava:true,
				}).then(res => {
					let {
						data = {}
					} = res;
					if(res.code==200){
						this.form=data
						let awardList=this.form.awardList
						awardList.forEach(item=>{
							this.$set(item,'imageList',item.awardImage?item.awardImage.split(','):[])
							this.$set(item,'uploadList',item.awardImage?item.awardImage.split(','):[])
							if(item.couponId){
								// 获取优惠券详情
								this.$request.post(this.$api.couponInfo, {
									store_id:uni.getStorageSync('store_id'),
									coupon_id:item.couponId
								}, {
									token:true
								}).then(res => {
									let {
										data = {}
									} = res;
									if (res.code==1) {
										if(data.valid_timedata==2){
											let customTimeArr=data.valid_configure.split(' - ')
											let start=customTimeArr[0]
											let end=customTimeArr[1]
											data.start=this.$tools.formatDay(start)
											data.end=this.$tools.formatDay(end)
										}
										this.$set(item,'couponInfo',data)
									}
								})
							}else{
								this.$set(item,'couponInfo',{})
							}
						})
						if(awardList.length>0){
							this.prizeData=awardList
						}
						
						this.collectionBallStartTime=this.form.collectionBallStartTime.split(" ")[0]
						this.collectionBallEndTime=this.form.collectionBallEndTime.split(" ")[0]
						this.lotteryDate=this.form.lotteryDate
						this.lotteryTime=this.splitBySecondOccurrence(this.form.lotteryTime,':')[0]
					}	
				})	
			},
			
			// 提交
			handleSubmit(){
				if(this.form.activeStatus==2||this.form.activeStatus==4){
					this.$tools.showToast('进行中活动，不可修改');
					return
				}else if(this.form.activeStatus==3){
					this.$tools.showToast('已结束活动，不可修改');
					return
				}
				this.submit()	
			},
			
			
			submit(){
				if(this.form.giftsNumber>2){
					this.$tools.showToast('赠送抽卡次数最多2次');
					return;
				}
				if(this.prizeData.length<3){
					this.$tools.showToast('奖品请设置3~5个');
					return;
				}
				let arr=[]
				this.prizeData.forEach(item=>{
					item.storeId=uni.getStorageSync('store_id')
					item.awardImage=item.uploadList.join(',')
				})
				this.form.awardList=this.prizeData
				
				if(this.form.id &&this.delData.length>0){
					this.delData.forEach(item=>{
						item.isVaild=2
					})
					this.form.awardList=this.form.awardList.concat(this.delData)
				}
				this.form.storeId=uni.getStorageSync('store_id')
				console.log(this.form,"提交的数据")
				
				this.$request.post(this.$api.collectBallActiveAddEdit, this.form, {
					isJava:true,
				}).then(res => {
					let {
						data = {}
					} = res;
					if(res.code==200){
						if(this.form.id){
							this.$tools.showToast('修改成功')
						}else{
							this.$tools.showToast('新增成功')
						}
						setTimeout(()=>{
							uni.navigateBack()
						},1000)
					}
				})	
			},
			
			// 过滤出选中的数据
			getAbsentValues(arr1, arr2){
			    let res = [];
			    res = arr1.filter(item => {
			        return arr2.find(el => {
			            return item.value == el
			       });
			    });
			    return res
			},
			
			convertStringToArray(commaSeparatedString) {
				if(commaSeparatedString){
					// 使用split函数以逗号为分隔符将字符串拆分为数组
					let numberArray = commaSeparatedString.split(',');
					// 使用map函数将字符串数组中的每个元素转换为数字
					numberArray = numberArray.map(Number);
					return numberArray;
				}else{
					return []
				}
			},
			
			// 第二个出现的特定分隔符处分割开
			splitBySecondOccurrence(str, delimiter) {
				const index = str.indexOf(delimiter);
				if (index === -1) {
					return [str]; // 如果没有找到分隔符，返回原字符串作为单个元素的数组
				}
				const secondIndex = str.indexOf(delimiter, index + 1);
				if (secondIndex === -1) {
					return [str]; // 如果只有一个分隔符，返回原字符串作为单个元素的数组
				}
				// 分割字符串
				return [
					str.slice(0, secondIndex), // 第一部分，从开始到第二个分隔符之前
					str.slice(secondIndex + delimiter.length), // 第二部分，从第二个分隔符之后开始
				];
			},
		},
	}
</script>

<style lang="scss" scoped>
	.container{
		padding: 30upx;
		overflow: hidden; // 解除BFC问题
		.modle-title{
			font-size: 36rpx;
			font-weight: bold;
			color: #fff;
			text-align: center;
			letter-spacing: 2rpx;
			&:not(:first-child){
				margin-top: 60rpx;
			}
		}
		.remaks-box{
			font-size: 28rpx;
			color: #82819B;
			line-height: 40rpx;
			margin-top: 12upx;
		}
		
		/deep/.modle-info-box {
			.info-item {
				font-size: 28upx;
				font-family: PingFang SC;
				font-weight: 400;
				line-height: 40upx;
				color: #FFFFFF;
				padding: 30upx 0;
				border-bottom: 1upx solid #36355E;
				position: relative;
				.small {
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
					margin: 0 40upx;
				}
				picker{
					flex: 1;
				}
				.select-input{
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #FFE577;
					flex: 1;
				}
				input {
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #FFE577;
					flex: 1;
				}
				textarea{
					border: 2rpx solid #36355E;
					border-radius: 8rpx;
					padding: 10rpx 20rpx;
					width: 100%;
					height: 150rpx;
					box-sizing: border-box;
					color: #FFE577;
				}
				.icon-more {
					border-color: #FFFFFF;
					position: absolute;
					right: 10rpx;
					pointer-events: none;
				}
		
				.placeholderclass {
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #FFE577;
				}
				.radio-group{
					gap: 40rpx;
				}
			}
			.add-lable{
				margin-top: 6rpx;
				color: #26BCFD;
				font-size: 26rpx;
				
			}
			
		}
		
		.coupon-box {
			margin-top: 20upx;
			.title {
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				margin-bottom: 22rpx;
			}
		
			.select-box {
				height: 140upx;
				line-height: 140upx;
				border: 1rpx dashed #FFFFFF;
				border-radius: 20upx 20upx;
				text-align: center;
		
				.select-text {
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #FD8926;
				}
			}
		
			.coupon-item {
				margin-bottom: 20upx;
				height: 140upx;
				background: #FFF5C9;
				border-radius: 20upx 20upx;
				position: relative;
		
				.left-circular {
					width: 30upx;
					height: 30upx;
					border-radius: 50%;
					background: #040336;
					position: absolute;
					left: -15upx;
					bottom: 0;
					bottom: -15rpx;
				}
		
				.right-circular {
					width: 30upx;
					height: 30upx;
					border-radius: 50%;
					background: #040336;
					position: absolute;
					right: -15upx;
					bottom: -15rpx;
				}
		
				.coupon-left {
					width: 224upx;
					align-items: baseline;
					justify-content: center;
		
					.money {
						font-size: 52upx;
						font-family: PingFang SC;
						font-weight: 500;
						line-height: 100upx;
						color: #000000;
					}
		
					.money-tip {
						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #000000;
						margin-left: 20rpx;
					}
				}
		
				.coupon-line {
					width: 2upx;
					height: 110upx;
					background: #040336;
				}
		
				.coupon-right {
					font-size: 24upx;
					font-family: PingFang SC;
					font-weight: 400;
					line-height: 44upx;
					color: #000000;
					margin-left: 32upx;
					flex: 1;
					.coupon-name {
						font-size: 36upx;
						font-family: PingFang SC;
						font-weight: 600;
						line-height: 50upx;
						color: #000000;
					}
				}
		
			}
		}
		
		.attachment-box {
			margin-top: 30upx;
			flex-wrap: wrap;
			gap: 20rpx;
			.add-btn {
				width: 156rpx;
				height: 156rpx;
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				border: 1upx solid #36355E;
				position: relative;
				flex-shrink: 0;
		
				&::after {
					content: "";
					display: inline-block;
					width: 40upx;
					height: 4upx;
					background: #36355E;
					position: absolute;
					left: 0;
					right: 0;
					top: 0;
					bottom: 0;
					margin: auto;
				}
		
				&::before {
					content: "";
					display: inline-block;
					width: 4upx;
					height: 40upx;
					background: #36355E;
					position: absolute;
					left: 0;
					right: 0;
					top: 0;
					bottom: 0;
					margin: auto;
				}
			}
		
			.attachment-img {
				width: 156rpx;
				height: 156rpx;
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				position: relative;
				flex-shrink: 0;		
				.close-btn {
					position: absolute;
					top: -10upx;
					right: -10upx;
					width: 40upx;
					height: 40upx;
				}
			}
		}
		
		.attachment-tips {
			font-size: 24upx;
			margin-top: 20upx;
		}
		
		.submit-btn{
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			width: 500rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			background: #26BCFD;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin: 60rpx auto;
		}
	}	
</style>